

from django.urls import path
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token

from apps.meiduo_admin import login
from apps.meiduo_admin.view.count_views import UserDailyActiveCountView, UserDailyOrderCountView, UserMonthCountView, \
    UserDayCountView
from apps.meiduo_admin.view.image_views import SKUImageView, SKUView
from apps.meiduo_admin.view.sku_view import SKUModelViewSet, SKUCategoriesView, GoodsSimpleView, GoodsSpecView
from apps.meiduo_admin.view.user_view import UserListView

urlpatterns = [
    # 添加返回token的view
    path('authorizations/', login.admin_jwt_token),
    # 日活跃用户
    path('statistical/day_active/', UserDailyActiveCountView.as_view()),
    # 日下单用户
    path('statistical/day_orders/', UserDailyOrderCountView.as_view()),
    # 月新增用户
    path('statistical/month_increment/', UserMonthCountView.as_view()),
    # 日增用户统计
    path('statistical/day_increment/', UserDayCountView.as_view()),
    # 获取所有用户
    path('users/', UserListView.as_view()),
     #获取所有的sku数据
    path('skus/simple/', SKUView.as_view()),
    #获取三级类别
    path('skus/categories/', SKUCategoriesView.as_view()),
    #获取简单的spu数据
    path('goods/simple/',GoodsSimpleView.as_view()),
    # 获取SPU商品规格信息
    path('goods/<int:pk>/specs/', GoodsSpecView.as_view()),
]
# 创建router实例
router = DefaultRouter()
# 注册路由
router.register(r'skus/images', SKUImageView, basename='image')
router.register(r'skus', SKUModelViewSet, basename='sku')
# 将路由添加进去
urlpatterns += router.urls
